package servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.SQLException;

import javax.servlet.*;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import Metier.I_Planning;
import Metier.Planning;


/**
 * Servlet implementation class BdAddUS
 */
@WebServlet("/BdAddUS")
public class BdAddUS extends HttpServlet {
	private static final long serialVersionUID = 1L;

	private I_Planning planning;
	private PrintWriter out;
	public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
	{
		res.setContentType("text/html");
		try
		{
			this.planning = new Planning();
			out = res.getWriter();
			//System.out.println(req.getParameter("pos"));
			out.print(planning.addUS(req.getParameter("nom"), req.getParameter("etat"), req.getParameter("desc"), req.getParameter("pos")));
			planning.close();
			planning = null;
		}
		catch(SQLException e)
		{
	        out.print("SQLException: " + e.getMessage());
	        e.printStackTrace();
					
		}
		out.close();
	}
}
